package com.example.xd.javatest.proxy_test;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @auther XuDan on 2020/6/15.
 */
public class AutoProxy implements InvocationHandler {

    private Sing mSing;

    public AutoProxy(Sing sing) {
        mSing = sing;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        if (method.getName().equals("sing")) {
            method.invoke(mSing, args);
        }
        return null;
    }
}
